import sys
import re

res = []
a = set(open(sys.argv[1], 'r').readlines())

for i in a:
    try:
        ip = re.findall(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", i)[0]
        res.append(ip + "\n")
    except:
        pass

open(sys.argv[1] + "_ip", 'w').writelines(res)
